class CmallCardM {
  CmallCardM({
    required this.list,
    required this.total,
  });

  CmallCardM.fromJson(dynamic json) {
    list = [];
    if (json['list'] != null) {
      json['list'].forEach((v) {
        list.add(Card.fromJson(v));
      });
    }
    total = json['total'];
  }

  late List<Card> list;
  late num total;

  CmallCardM copyWith({
    List<Card>? list,
    num? total,
  }) =>
      CmallCardM(
        list: list ?? this.list,
        total: total ?? this.total,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['list'] = list.map((v) => v.toJson()).toList();
    map['total'] = total;
    return map;
  }
}

class Card {
  Card({
    required this.areaCodeEn,
    required this.areaCodeList,
    required this.areaLimit,
    required this.areaList,
    required this.cardName,
    required this.cardType,
    required this.dayTimes,
    required this.discountPrice,
    required this.effectDays,
    required this.id,
    required this.price,
    required this.reduceAmount,
    required this.saleTimes,
    required this.scope,
    required this.staticTagsList,
    required this.subType,
    this.tagsList,
    required this.times,
  });

  Card.fromJson(dynamic json) {
    areaCodeEn =
        json['area_code_en'] != null ? json['area_code_en'].cast<String>() : [];
    areaCodeList = json['area_code_list'] != null
        ? json['area_code_list'].cast<String>()
        : [];
    areaLimit = json['area_limit'];
    areaList =
        json['area_list'] != null ? json['area_list'].cast<String>() : [];
    cardName = json['card_name'];
    cardType = json['card_type'];
    dayTimes = json['day_times'];
    discountPrice = json['discount_price'];
    effectDays = json['effect_days'];
    id = json['id'];
    price = json['price'];
    reduceAmount = json['reduce_amount'];
    saleTimes = json['sale_times'];
    scope = json['scope'];
    staticTagsList = json['static_tags_list'] != null
        ? json['static_tags_list'].cast<String>()
        : [];
    subType = json['sub_type'];
    tagsList = json['tags_list'];
    times = json['times'];
  }

  late List<String> areaCodeEn;
  late List<String> areaCodeList;
  late num areaLimit;
  late List<String> areaList;
  late String cardName;
  late num cardType;
  late num dayTimes;
  late num discountPrice;
  late num effectDays;
  late String id;
  late num price;
  late num reduceAmount;
  late num saleTimes;
  late num scope;
  late List<String> staticTagsList;
  late num subType;
  dynamic tagsList;
  late num times;

  Card copyWith({
    List<String>? areaCodeEn,
    List<String>? areaCodeList,
    num? areaLimit,
    List<String>? areaList,
    String? cardName,
    num? cardType,
    num? dayTimes,
    num? discountPrice,
    num? effectDays,
    String? id,
    num? price,
    num? reduceAmount,
    num? saleTimes,
    num? scope,
    List<String>? staticTagsList,
    num? subType,
    dynamic tagsList,
    num? times,
  }) =>
      Card(
        areaCodeEn: areaCodeEn ?? this.areaCodeEn,
        areaCodeList: areaCodeList ?? this.areaCodeList,
        areaLimit: areaLimit ?? this.areaLimit,
        areaList: areaList ?? this.areaList,
        cardName: cardName ?? this.cardName,
        cardType: cardType ?? this.cardType,
        dayTimes: dayTimes ?? this.dayTimes,
        discountPrice: discountPrice ?? this.discountPrice,
        effectDays: effectDays ?? this.effectDays,
        id: id ?? this.id,
        price: price ?? this.price,
        reduceAmount: reduceAmount ?? this.reduceAmount,
        saleTimes: saleTimes ?? this.saleTimes,
        scope: scope ?? this.scope,
        staticTagsList: staticTagsList ?? this.staticTagsList,
        subType: subType ?? this.subType,
        tagsList: tagsList ?? this.tagsList,
        times: times ?? this.times,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['area_code_en'] = areaCodeEn;
    map['area_code_list'] = areaCodeList;
    map['area_limit'] = areaLimit;
    map['area_list'] = areaList;
    map['card_name'] = cardName;
    map['card_type'] = cardType;
    map['day_times'] = dayTimes;
    map['discount_price'] = discountPrice;
    map['effect_days'] = effectDays;
    map['id'] = id;
    map['price'] = price;
    map['reduce_amount'] = reduceAmount;
    map['sale_times'] = saleTimes;
    map['scope'] = scope;
    map['static_tags_list'] = staticTagsList;
    map['sub_type'] = subType;
    map['tags_list'] = tagsList;
    map['times'] = times;
    return map;
  }
}
